<template>
  <div class="ProdBaskComment">
    <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
      <div v-for="item in ProdBaskComment" :key="item.id">
        <h3>
          <van-image round width="16px" height="16px" :src="item.img" />
          <span>{{item.name}}</span>
        </h3>
        <p>{{item.text}}</p>
        <div class="img">
          <img :src="item.img" alt />
          <img :src="item.img" alt />
        </div>
      </div>
    </van-list>
  </div>
</template>

<script>
import * as api from "@/api/getProlist.js";
export default {
  name: "ProdBaskComment",
  data() {
    return {
      ProdBaskComment: [],
      active: 0,
      loading: false,
      finished: false
    };
  },
  methods: {
    onLoad() {
      // 异步更新数据
      setTimeout(() => {
        for (let i = 0; i < 10; i++) {
          this.list.push(this.ProdBaskComment.length + 1);
        }
        // 加载状态结束
        this.loading = false;

        // 数据全部加载完成
        if (this.ProdBaskComment.length >= 40) {
          this.finished = true;
        }
      }, 500);
    }
  },
  mounted() {
    api.getProlist().then(data => {
      console.log(data.data.ProdBaskComment);

      this.ProdBaskComment = data.data.ProdBaskComment;
    });
  }
};
</script>

<style scoped>
.ProdBaskComment {
  width: 100%;
}
.ProdBaskComment h3 {
  height: 40px;
  line-height: 40px;
  vertical-align: center;
}
.ProdBaskComment h3 span {
  margin-left: 10px;
  font-size: 32px;
  vertical-align: center;
}
.ProdBaskComment p {
  margin-left: 60px;
}
.ProdBaskComment .img {
  margin-left: 50px;
  overflow: hidden;
}
.ProdBaskComment .img img {
  width: 40%;
  height: 300px;
  padding: 10px;
  float: left;
}
</style>